// 所有人日报控制器
define('workEverybodyController', ['angular','jquery','datetimepicker','moment'], function (angular,$,datetimepicker,moment) {
    var module = angular.module('controllers');
    module.controller('workEverybodyController', ['$scope','$rootScope','$filter','$route','userServers','dailyServers',function ($scope,$rootScope,$filter,$route,userServers,dailyServers) {
      	$scope.workList={};
        $scope.work_list=[{
            id:"1",
        	month:"",
            salesman:"222",
            salesman_id:"",
            branch_company:""
            
        }];
        $scope.searchWorkForm=function(){
            $scope.workList = $filter('simplifyJsonFilter')($scope.workList);
            dailyServers.searchWork($scope.workList).then(function(data) {
                $scope.work_list=data;
            });
        };
        $scope.searchWorkForm();
        $scope.addMeetingForm={
            time:"",
            daily_content:"",
            user_id:""
        };
        $scope.addMeetingContent=function(valid){
            if(valid){
                $scope.addMeetingForm.user_id=$rootScope.user.id;
                $scope.addMeetingForm.user_type=$rootScope.user.type;
                $scope.addMeetingForm.user_company_id=$rootScope.user.company;
                $scope.addMeetingForm = $filter('simplifyJsonFilter')($scope.addMeetingForm);
                dailyServers.addMeetingList($scope.addMeetingForm).then(function (data) {
                    
                    if(data){
                        $route.reload($scope.addMeetingForm);
                    }else{
                        alert("添加失败");
                    }
                });
            }else{
                alert("请填写全部信息");
            }
        };
    }]);
});
